package com.geek.javase.ch07.regex;

import java.util.Scanner;

/*
 *@author wangpeng
 *2025/10/15 19:23
 *@description TODO
 */
//7.密码强度校验，控制台输入字符串，判断其弱、中、强（数字+字母+特殊符号）
public class Demo7 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入密码：");
        String password = scanner.nextLine();

        int count = 0;
        if (password.matches(".*[a-z].*")) {
            count++;
        }
        if (password.matches(".*[A-Z].*")) {
            count++;
        }
        if (password.matches(".*[0-9].*")) {
            count++;
        }
        if (password.matches(".*[^a-zA-Z0-9].*")) {
            count++;
        }
        if (count == 1) {
            System.out.println("弱");
        } else if (count == 2 || count == 3) {
            System.out.println("中");
        } else if (count == 4) {
            System.out.println("强");
        } else {
            System.out.println("弱");
        }
    }
}

